#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import datetime
from typing import Optional,List

from pydantic import BaseModel, Field, EmailStr


class Auth3(BaseModel):
    alias: str = Field(..., example='Alice')
    password: str



class Auth(BaseModel):
    username: str
    password: str


class ELCode(BaseModel):
    email: EmailStr


class Auth2(ELCode):
    code: str


# class CreateUser(Auth3):
#     work_id: str = Field(..., example='K2207368')
#     user_name: str = Field(..., example='爱丽丝')
#     email: str = Field(..., example='123@qq.com')
#     user_desc:str = Field(..., example='IDL')
#     department:str = Field(..., example='ML6KA3')

#     is_boss: bool = Field(..., example=True)
#     is_big_boss: bool = Field(..., example=True)
#     is_admin: bool = Field(..., example=True)

class CreateUser(BaseModel):
    loginid:str= Field(...,example='当前用户的loginid')

    boss_level:int= Field(..., example=99)
    boss_logonid:str= Field(..., example='老板的loginid')
    boss_no:str= Field(... ,example='老板的工号')
    class_id:str= Field(...,example='常日班,长白班')
    e_mail:str= Field(...,example='邮箱')
    emp_name:str= Field(...,example='中文姓名')
    emp_no:str= Field(...,example='工号')
    emp_type:str= Field(...,example='一般员工,派如员工')
    eng_name:str= Field(...,example='英文加中文名称')
    job_idl:str= Field(...,example='idl,dl')
    org_id:str= Field(...,example='所在的部分,小部门')
    sex:str= Field(...,example='性别')
    title:str= Field(...,example='职称,工程师,副理,经理,总经理,董事长...')
    come_date:str= Field(...,example='进入公司的日期')
    roles: List[str] = Field(['agv_common']) # 当前用户的角色，用于控制前端界面的展示
 


class UpdateUser(BaseModel):
    username: str
    email: str
    mobile_number: Optional[str] = None
    wechat: Optional[str] = None
    qq: Optional[str] = None
    blog_address: Optional[str] = None
    introduction: Optional[str] = None


class GetUserInfo(UpdateUser):
    id: int
    uid: str
    avatar: Optional[str] = None
    time_joined: datetime.datetime = None
    last_login: Optional[datetime.datetime] = None
    is_superuser: bool
    is_active: bool

    class Config:
        orm_mode = True


class DeleteUser(BaseModel):
    id: int


class ResetPassword(BaseModel):
    code: str
    password1: str
    password2: str
